声明 模块 "tls" {

    //@@{ 加密算法:crypto }
    导入 * 转为 加密算法 来自 "crypto";
    导入 * 转为 dns 来自 "dns";

    //@@{ 网络:net }
    导入 * 转为 网络 来自 "net";

    //@@{ 流:stream }
    导入 * 转为 流 来自 "stream";

    //@@{ __客户端_重新协商次数_限制__:CLIENT_RENEG_LIMIT }
    常量 __客户端_重新协商次数_限制__: 数字;

    //@@{ __客户端_重新协商窗口秒数_限制__:CLIENT_RENEG_WINDOW }
    常量 __客户端_重新协商窗口秒数_限制__: 数字;

    //@@{ 证书_:Certificate }
    接口 证书_ {
        /**
         * Country code.
         */
        C: 文字;
        /**
         * Street.
         */
        ST: 文字;
        /**
         * Locality.
         */
        L: 文字;
        /**
         * Organization.
         */
        O: 文字;
        /**
         * Organizational unit.
         */
        OU: 文字;
        /**
         * Common name.
         */
        CN: 文字;
    }

    //@@{ 对等证书_:PeerCertificate }
    接口 对等证书_ {

        //@@{ 主题:subject, 证书_:Certificate }
        主题: 证书_;

        //@@{ 发行人:issuer, 证书_:Certificate }
        发行人: 证书_;

        //@@{ 主题备用名称:subjectaltname }
        主题备用名称: 文字;

        //@@{ 信息访问:infoAccess }
        信息访问: { [索引: 文字]: 文字[] | 未定 };

        //@@{ 模数:modulus }
        模数: 文字;

        //@@{ 指数:exponent }
        指数: 文字;

        //@@{ 有效的_从:valid_from }
        有效的_从: 文字;

        //@@{ 有效的_到:valid_to }
        有效的_到: 文字;

        //@@{ 指纹:fingerprint }
        指纹: 文字;

        //@@{ 扩展_键_使用:ext_key_usage }
        扩展_键_使用: 文字[];

        //@@{ 序列号:serialNumber }
        序列号: 文字;

        //@@{ 原料:raw, 缓冲区_:Buffer }
        原料: 缓冲区_;
    }

    //@@{ 详细的对等证书_:DetailedPeerCertificate, 对等证书_:PeerCertificate }
    接口 详细的对等证书_ 扩展 对等证书_ {

        //@@{ 发行者证书:issuerCertificate, 详细的对等证书_:DetailedPeerCertificate }
        发行者证书: 详细的对等证书_;
    }

    //@@{ 加密名字和协议_:CipherNameAndProtocol }
    接口 加密名字和协议_ {
        /**
         * The cipher name.
         */

        //@@{ 名称:name }
        名称: 文字;
        /**
         * SSL/TLS protocol version.
         */

        //@@{ 版本:version }
        版本: 文字;
    }

    //@@{ TLS套接字_:TLSSocket, 网络:net, 套接字_:Socket }
    类别 TLS套接字_ 扩展 网络.套接字_ {
        /**
         * Construct a new tls.TLSSocket object from an existing TCP socket.
         */

        //@@{ 网络:net, 套接字_:Socket }
        构造(套接字: 网络.套接字_, 选项组?: {
            /**
             * An optional TLS context object from tls.createSecureContext()
             */

            //@@{ 安全上下文:secureContext, 安全上下文_:SecureContext }
            安全上下文?: 安全上下文_,
            /**
             * If true the TLS socket will be instantiated in server-mode.
             * Defaults to false.
             */

            //@@{ 是服务器:isServer }
            是服务器?: 真假,
            /**
             * An optional net.Server instance.
             */

            //@@{ 服务器:server, 网络:net, 服务器_:Server }
            服务器?: 网络.服务器_,
            /**
             * If true the server will request a certificate from clients that
             * connect and attempt to verify that certificate. Defaults to
             * false.
             */

            //@@{ 请求证书:requestCert }
            请求证书?: 真假,
            /**
             * If true the server will reject any connection which is not
             * authorized with the list of supplied CAs. This option only has an
             * effect if requestCert is true. Defaults to false.
             */

            //@@{ 拒绝未授权:rejectUnauthorized }
            拒绝未授权?: 真假,
            /**
             * An array of strings or a Buffer naming possible NPN protocols.
             * (Protocols should be ordered by their priority.)
             */

            //@@{ NPN型协议_:NPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
            NPN型协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_,
            /**
             * An array of strings or a Buffer naming possible ALPN protocols.
             * (Protocols should be ordered by their priority.) When the server
             * receives both NPN and ALPN extensions from the client, ALPN takes
             * precedence over NPN and the server does not send an NPN extension
             * to the client.
             */

            //@@{ ALPN协议_:ALPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
            ALPN协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_,
            /**
             * SNICallback(servername, cb) <Function> A function that will be
             * called if the client supports SNI TLS extension. Two arguments
             * will be passed when called: servername and cb. SNICallback should
             * invoke cb(null, ctx), where ctx is a SecureContext instance.
             * (tls.createSecureContext(...) can be used to get a proper
             * SecureContext.) If SNICallback wasn't provided the default callback
             * with high-level API will be used (see below).
             */

            //@@{ SNI回调_:SNICallback, 错误_:Error, 安全上下文_:SecureContext }
            SNI回调_?: (服务器名称: 文字, 回调: (错: 错误_ | 空值, 上下文: 安全上下文_) => 无值) => 无值,
            /**
             * An optional Buffer instance containing a TLS session.
             */

            //@@{ 会话:session, 缓冲区_:Buffer }
            会话?: 缓冲区_,
            /**
             * If true, specifies that the OCSP status request extension will be
             * added to the client hello and an 'OCSPResponse' event will be
             * emitted on the socket before establishing a secure communication
             */

            //@@{ 请求OCSP:requestOCSP }
            请求OCSP?: 真假
        });

        /**
         * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
         */

        //@@{ 授权:authorized }
        授权: 真假;
        /**
         * The reason why the peer's certificate has not been verified.
         * This property becomes available only when tlsSocket.authorized === false.
         */

        //@@{ 授权错误:authorizationError, 错误_:Error }
        授权错误: 错误_;
        /**
         * Static boolean value, always true.
         * May be used to distinguish TLS sockets from regular ones.
         */

        //@@{ 加密的:encrypted }
        加密的: 真假;

        /**
         * String containing the selected ALPN protocol.
         * When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false.
         */

        //@@{ alpn协议:alpnProtocol }
        alpn协议?: 文字;

        /**
         * Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
         * @returns Returns an object representing the cipher name
         * and the SSL/TLS protocol version of the current connection.
         */

        //@@{ 获取加密:getCipher, 加密名字和协议_:CipherNameAndProtocol }
        获取加密(): 加密名字和协议_;
        /**
         * Returns an object representing the peer's certificate.
         * The returned object has some properties corresponding to the field of the certificate.
         * If detailed argument is true the full chain with issuer property will be returned,
         * if false only the top certificate without issuer property.
         * If the peer does not provide a certificate, it returns null or an empty object.
         * @param detailed - If true; the full chain with issuer property will be returned.
         * @returns An object representing the peer's certificate.
         */

        //@@{ 获取对等证书:getPeerCertificate, 详细的对等证书_:DetailedPeerCertificate }
        获取对等证书(详细的: 为真): 详细的对等证书_;

        //@@{ 获取对等证书:getPeerCertificate, 对等证书_:PeerCertificate }
        获取对等证书(详细的?: 为假): 对等证书_;

        //@@{ 获取对等证书:getPeerCertificate, 对等证书_:PeerCertificate, 详细的对等证书_:DetailedPeerCertificate }
        获取对等证书(详细的?: 真假): 对等证书_ | 详细的对等证书_;
        /**
         * Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
         * The value `'unknown'` will be returned for connected sockets that have not completed the handshaking process.
         * The value `null` will be returned for server sockets or disconnected client sockets.
         * See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information.
         * @returns negotiated SSL/TLS protocol version of the current connection
         */

        //@@{ 获取协议:getProtocol }
        获取协议(): 文字 | 空值;
        /**
         * Could be used to speed up handshake establishment when reconnecting to the server.
         * @returns ASN.1 encoded TLS session or undefined if none was negotiated.
         */

        //@@{ 获取会话:getSession, 缓冲区_:Buffer }
        获取会话(): 缓冲区_ | 未定;
        /**
         * NOTE: Works only with client TLS sockets.
         * Useful only for debugging, for session reuse provide session option to tls.connect().
         * @returns TLS session ticket or undefined if none was negotiated.
         */

        //@@{ 获取TLS门票:getTLSTicket, 缓冲区_:Buffer }
        获取TLS门票(): 缓冲区_ | 未定;
        /**
         * Initiate TLS renegotiation process.
         *
         * NOTE: Can be used to request peer's certificate after the secure connection has been established.
         * ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
         * @param options - The options may contain the following fields: rejectUnauthorized,
         * requestCert (See tls.createServer() for details).
         * @param callback - callback(err) will be executed with null as err, once the renegotiation
         * is successfully completed.
         * @return `undefined` when socket is destroy, `false` if negotiaion can't be initiated.
         */

        //@@{ 重新谈判:renegotiate, 拒绝未授权:rejectUnauthorized, 请求证书:requestCert, 错误_:Error }
        重新谈判(选项组: { 拒绝未授权?: 真假, 请求证书?: 真假 }, 回调: (错: 错误_ | 空值) => 无值): 未定 | 真假;
        /**
         * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512).
         * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by
         * the TLS layer until the entire fragment is received and its integrity is verified;
         * large fragments can span multiple roundtrips, and their processing can be delayed due to packet
         * loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead,
         * which may decrease overall server throughput.
         * @param size - TLS fragment size (default and maximum value is: 16384, minimum is: 512).
         * @returns Returns true on success, false otherwise.
         */

        //@@{ 设置最大发送片段:setMaxSendFragment }
        设置最大发送片段(大小: 数字): 真假;

        /**
         * events.EventEmitter
         * 1. OCSPResponse
         * 2. secureConnect
         */

        //@@{ 添加监听器:addListener }
        添加监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 添加监听器:addListener, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        添加监听器(事件: "OCSP响应_", 监听器: (响应: 缓冲区_) => 无值): 本体;

        //@@{ 添加监听器:addListener, "安全连接":"secureConnect" }
        添加监听器(事件: "安全连接", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "会话":"session", 缓冲区_:Buffer }
        添加监听器(事件: "会话", 监听器: (会话: 缓冲区_) => 无值): 本体;

        //@@{ 发出:emit }
        发出(事件: 文字 | 符号, ...参数组: 任意[]): 真假;

        //@@{ 发出:emit, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        发出(事件: "OCSP响应_", 响应: 缓冲区_): 真假;

        //@@{ 发出:emit, "安全连接":"secureConnect" }
        发出(事件: "安全连接"): 真假;

        //@@{ 发出:emit, "会话":"session", 缓冲区_:Buffer }
        发出(事件: "会话", 会话: 缓冲区_): 真假;

        //@@{ 正在:on }
        正在(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 正在:on, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        正在(事件: "OCSP响应_", 监听器: (响应: 缓冲区_) => 无值): 本体;

        //@@{ 正在:on, "安全连接":"secureConnect" }
        正在(事件: "安全连接", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "会话":"session", 缓冲区_:Buffer }
        正在(事件: "会话", 监听器: (会话: 缓冲区_) => 无值): 本体;

        //@@{ 一次:once }
        一次(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 一次:once, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        一次(事件: "OCSP响应_", 监听器: (响应: 缓冲区_) => 无值): 本体;

        //@@{ 一次:once, "安全连接":"secureConnect" }
        一次(事件: "安全连接", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "会话":"session", 缓冲区_:Buffer }
        一次(事件: "会话", 监听器: (会话: 缓冲区_) => 无值): 本体;

        //@@{ 预处理监听器:prependListener }
        预处理监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        预处理监听器(事件: "OCSP响应_", 监听器: (响应: 缓冲区_) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "安全连接":"secureConnect" }
        预处理监听器(事件: "安全连接", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "会话":"session", 缓冲区_:Buffer }
        预处理监听器(事件: "会话", 监听器: (会话: 缓冲区_) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener }
        预处理一次监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "OCSP响应_":"OCSPResponse", 缓冲区_:Buffer }
        预处理一次监听器(事件: "OCSP响应_", 监听器: (响应: 缓冲区_) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "安全连接":"secureConnect" }
        预处理一次监听器(事件: "安全连接", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "会话":"session", 缓冲区_:Buffer }
        预处理一次监听器(事件: "会话", 监听器: (会话: 缓冲区_) => 无值): 本体;
    }

    //@@{ Tls选项_:TlsOptions, 安全上下文选项_:SecureContextOptions }
    接口 Tls选项_ 扩展 安全上下文选项_ {

        //@@{ 握手超时:handshakeTimeout }
        握手超时?: 数字;

        //@@{ 请求证书:requestCert }
        请求证书?: 真假;

        //@@{ 拒绝未授权:rejectUnauthorized }
        拒绝未授权?: 真假;

        //@@{ NPN型协议_:NPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
        NPN型协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_;

        //@@{ ALPN协议_:ALPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
        ALPN协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_;

        //@@{ SNI回调_:SNICallback, 错误_:Error, 安全上下文_:SecureContext }
        SNI回调_?: (服务器名称: 文字, 回调: (错: 错误_ | 空值, 上下文: 安全上下文_) => 无值) => 无值;

        //@@{ 会话超时:sessionTimeout }
        会话超时?: 数字;

        //@@{ 门票钥匙:ticketKeys, 缓冲区_:Buffer }
        门票钥匙?: 缓冲区_;
    }

    //@@{ 连接选项_:ConnectionOptions, 安全上下文选项_:SecureContextOptions }
    接口 连接选项_ 扩展 安全上下文选项_ {

        //@@{ 主机:host }
        主机?: 文字;

        //@@{ 端口:port }
        端口?: 数字;

        //@@{ 路径:path }
        路径?: 文字; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.

        //@@{ 套接字:socket, 网络:net, 套接字_:Socket }
        套接字?: 网络.套接字_; // Establish secure connection on a given socket rather than creating a new socket

        //@@{ 拒绝未授权:rejectUnauthorized }
        拒绝未授权?: 真假; // Defaults to true

        //@@{ NPN型协议_:NPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
        NPN型协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_;

        //@@{ ALPN协议_:ALPNProtocols, 缓冲区_:Buffer, 正整数数组8_:Uint8Array }
        ALPN协议_?: 文字[] | 缓冲区_[] | 正整数数组8_[] | 缓冲区_ | 正整数数组8_;

        //@@{ 检查服务器身份:checkServerIdentity }
        检查服务器身份?: 类为 检查服务器身份;

        //@@{ 服务器名称:servername }
        服务器名称?: 文字; // SNI TLS Extension

        //@@{ 会话:session, 缓冲区_:Buffer }
        会话?: 缓冲区_;

        //@@{ 最小DH大小:minDHSize }
        最小DH大小?: 数字;

        //@@{ 安全上下文:secureContext, 安全上下文_:SecureContext }
        安全上下文?: 安全上下文_; // If not provided, the entire ConnectionOptions object will be passed to tls.createSecureContext()

        //@@{ 查找:lookup, 网络:net, 查找函数_:LookupFunction }
        查找?: 网络.查找函数_;

        //@@{ 超时:timeout }
        超时?: 数字;
    }

    //@@{ 服务器_:Server, 网络:net }
    类别 服务器_ 扩展 网络.服务器_ {

        //@@{ 添加上下文:addContext, 安全上下文选项_:SecureContextOptions }
        添加上下文(主机名: 文字, 凭证组: 安全上下文选项_): 无值;

        /**
         * events.EventEmitter
         * 1. tlsClientError
         * 2. newSession
         * 3. OCSPRequest
         * 4. resumeSession
         * 5. secureConnection
         */

        //@@{ 添加监听器:addListener }
        添加监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 添加监听器:addListener, "tls客户端错误":"tlsClientError", 错误_:Error, TLS套接字_:TLSSocket }
        添加监听器(事件: "tls客户端错误", 监听器: (错: 错误_, tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 添加监听器:addListener, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        添加监听器(事件: "新会话", 监听器: (会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 添加监听器:addListener, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer, 错误_:Error }
        添加监听器(事件: "OCSP请求_", 监听器: (证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 添加监听器:addListener, "恢复会话":"resumeSession", 缓冲区_:Buffer, 错误_:Error }
        添加监听器(事件: "恢复会话", 监听器: (会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 添加监听器:addListener, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        添加监听器(事件: "安全连接", 监听器: (tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 发出:emit }
        发出(事件: 文字 | 符号, ...参数组: 任意[]): 真假;

        //@@{ 发出:emit, "tls客户端错误":"tlsClientError", 错误_:Error, TLS套接字_:TLSSocket }
        发出(事件: "tls客户端错误", 错: 错误_, tls套接字: TLS套接字_): 真假;

        //@@{ 发出:emit, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        发出(事件: "新会话", 会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值): 真假;

        //@@{ 发出:emit, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer, 错误_:Error }
        发出(事件: "OCSP请求_", 证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值): 真假;

        //@@{ 发出:emit, "恢复会话":"resumeSession", 缓冲区_:Buffer, 错误_:Error }
        发出(事件: "恢复会话", 会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值): 真假;

        //@@{ 发出:emit, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        发出(事件: "安全连接", tls套接字: TLS套接字_): 真假;

        //@@{ 正在:on }
        正在(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 正在:on, "tls客户端错误":"tlsClientError", 错误_:Error, TLS套接字_:TLSSocket }
        正在(事件: "tls客户端错误", 监听器: (错: 错误_, tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 正在:on, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        正在(事件: "新会话", 监听器: (会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 正在:on, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer, 错误_:Error }
        正在(事件: "OCSP请求_", 监听器: (证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 正在:on, "恢复会话":"resumeSession", 缓冲区_:Buffer, 错误_:Error }
        正在(事件: "恢复会话", 监听器: (会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 正在:on, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        正在(事件: "安全连接", 监听器: (tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 一次:once }
        一次(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 一次:once, "tls客户端错误":"tlsClientError", 错误_:Error, TLS套接字_:TLSSocket }
        一次(事件: "tls客户端错误", 监听器: (错: 错误_, tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 一次:once, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        一次(事件: "新会话", 监听器: (会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 一次:once, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer, 错误_:Error }
        一次(事件: "OCSP请求_", 监听器: (证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 一次:once, "恢复会话":"resumeSession", 缓冲区_:Buffer, 错误_:Error }
        一次(事件: "恢复会话", 监听器: (会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 一次:once, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        一次(事件: "安全连接", 监听器: (tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 预处理监听器:prependListener }
        预处理监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "tls客户端错误":"tlsClientError", 错误_:Error, TLS套接字_:TLSSocket }
        预处理监听器(事件: "tls客户端错误", 监听器: (错: 错误_, tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        预处理监听器(事件: "新会话", 监听器: (会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer, 错误_:Error }
        预处理监听器(事件: "OCSP请求_", 监听器: (证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "恢复会话":"resumeSession", 缓冲区_:Buffer, 错误_:Error }
        预处理监听器(事件: "恢复会话", 监听器: (会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        预处理监听器(事件: "安全连接", 监听器: (tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener }
        预处理一次监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "tls客户端错误":"tlsClientError", 错误_:Error }
        //@@{ TLS套接字_:TLSSocket }
        预处理一次监听器(事件: "tls客户端错误", 监听器: (错: 错误_, tls套接字: TLS套接字_) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "新会话":"newSession", 缓冲区_:Buffer, 错误_:Error }
        预处理一次监听器(事件: "新会话", 监听器: (会话Id: 缓冲区_, 会话数据: 缓冲区_, 回调: (错: 错误_, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "OCSP请求_":"OCSPRequest", 缓冲区_:Buffer }
        //@@{ 错误_:Error }
        预处理一次监听器(事件: "OCSP请求_", 监听器: (证书: 缓冲区_, 发行人: 缓冲区_, 回调: (错: 错误_ | 空值, 相关: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "恢复会话":"resumeSession", 缓冲区_:Buffer }
        //@@{ 错误_:Error }
        预处理一次监听器(事件: "恢复会话", 监听器: (会话Id: 缓冲区_, 回调: (错: 错误_, 会话数据: 缓冲区_) => 无值) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "安全连接":"secureConnection", TLS套接字_:TLSSocket }
        预处理一次监听器(事件: "安全连接", 监听器: (tls套接字: TLS套接字_) => 无值): 本体;
    }

    //@@{ 安全对_:SecurePair }
    接口 安全对_ {

        //@@{ 加密的:encrypted, TLS套接字_:TLSSocket }
        加密的: TLS套接字_;

        //@@{ 明文:cleartext, TLS套接字_:TLSSocket }
        明文: TLS套接字_;
    }

    //@@{ 安全版本_:SecureVersion }
    类型 安全版本_ = 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';

    //@@{ 安全上下文选项_:SecureContextOptions }
    接口 安全上下文选项_ {

        //@@{ 前缀:pfx, 缓冲区_:Buffer, 数组_:Array, 实例_:Object }
        前缀?: 文字 | 缓冲区_ | 数组_<文字 | 缓冲区_ | 实例_>;

        //@@{ 密钥:key, 缓冲区_:Buffer, 数组_:Array, 实例_:Object }
        密钥?: 文字 | 缓冲区_ | 数组_<缓冲区_ | 实例_>;

        //@@{ 口令:passphrase }
        口令?: 文字;

        //@@{ 证书:cert, 缓冲区_:Buffer, 数组_:Array }
        证书?: 文字 | 缓冲区_ | 数组_<文字 | 缓冲区_>;

        //@@{ ca证书:ca, 缓冲区_:Buffer, 数组_:Array }
        ca证书?: 文字 | 缓冲区_ | 数组_<文字 | 缓冲区_>;

        //@@{ 加密套件:ciphers }
        加密套件?: 文字;

        //@@{ 荣誉加密顺序:honorCipherOrder }
        荣誉加密顺序?: 真假;

        //@@{ ecdh曲线:ecdhCurve }
        ecdh曲线?: 文字;

        //@@{ 客户端证书引擎:clientCertEngine }
        客户端证书引擎?: 文字;

        //@@{ 证书吊销列表:crl, 缓冲区_:Buffer, 数组_:Array }
        证书吊销列表?: 文字 | 缓冲区_ | 数组_<文字 | 缓冲区_>;

        //@@{ dh参数:dhparam, 缓冲区_:Buffer }
        dh参数?: 文字 | 缓冲区_;

        //@@{ 安全选项:secureOptions }
        安全选项?: 数字; // Value is a numeric bitmask of the `SSL_OP_*` options

        //@@{ 安全协议:secureProtocol }
        安全协议?: 文字; // SSL Method, e.g. SSLv23_method

        //@@{ 会话Id上下文:sessionIdContext }
        会话Id上下文?: 文字;
        /**
         * Optionally set the maximum TLS version to allow. One
         * of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
         * `secureProtocol` option, use one or the other.  **Default:** `'TLSv1.2'`.
         */

        //@@{ 最大版本:maxVersion, 安全版本_:SecureVersion }
        最大版本?: 安全版本_;
        /**
         * Optionally set the minimum TLS version to allow. One
         * of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
         * `secureProtocol` option, use one or the other.  It is not recommended to use
         * less than TLSv1.2, but it may be required for interoperability.
         * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
         * `--tls-v1.0` changes the default to `'TLSv1'`. Using `--tls-v1.1` changes
         * the default to `'TLSv1.1'`.
         */

        //@@{ 最小版本:minVersion, 安全版本_:SecureVersion }
        最小版本?: 安全版本_;
    }

    //@@{ 安全上下文_:SecureContext }
    接口 安全上下文_ {

        //@@{ 上下文:context }
        上下文: 任意;
    }

    /*
     * Verifies the certificate `cert` is issued to host `host`.
     * @host The hostname to verify the certificate against
     * @cert PeerCertificate representing the peer's certificate
     *
     * Returns Error object, populating it with the reason, host and cert on failure.  On success, returns undefined.
     */

    //@@{ 检查服务器身份:checkServerIdentity, 对等证书_:PeerCertificate, 错误_:Error }
    函数 检查服务器身份(主机: 文字, 证书: 对等证书_): 错误_ | 未定;

    //@@{ 创建服务器:createServer, TLS套接字_:TLSSocket, 服务器_:Server }
    函数 创建服务器(安全连接监听器?: (套接字: TLS套接字_) => 无值): 服务器_;

    //@@{ 创建服务器:createServer, Tls选项_:TlsOptions, TLS套接字_:TLSSocket, 服务器_:Server }
    函数 创建服务器(选项组: Tls选项_, 安全连接监听器?: (套接字: TLS套接字_) => 无值): 服务器_;

    //@@{ 连接:connect, 连接选项_:ConnectionOptions, TLS套接字_:TLSSocket }
    函数 连接(选项组: 连接选项_, 安全连接监听器?: () => 无值): TLS套接字_;

    //@@{ 连接:connect, 连接选项_:ConnectionOptions, TLS套接字_:TLSSocket }
    函数 连接(端口: 数字, 主机?: 文字, 选项组?: 连接选项_, 安全连接监听器?: () => 无值): TLS套接字_;

    //@@{ 连接:connect, 连接选项_:ConnectionOptions, TLS套接字_:TLSSocket }
    函数 连接(端口: 数字, 选项组?: 连接选项_, 安全连接监听器?: () => 无值): TLS套接字_;
    /**
     * @deprecated
     */

    //@@{ 创建安全对:createSecurePair, 安全上下文_:SecureContext, 安全对_:SecurePair }
    函数 创建安全对(凭证组?: 安全上下文_, 是服务器?: 真假, 请求证书?: 真假, 拒绝未授权?: 真假): 安全对_;

    //@@{ 创建安全上下文:createSecureContext, 安全上下文选项_:SecureContextOptions, 安全上下文_:SecureContext }
    函数 创建安全上下文(细节组: 安全上下文选项_): 安全上下文_;

    //@@{ 获取密码:getCiphers }
    函数 获取密码(): 文字[];

    //@@{ __默认_ECDH_曲线__:DEFAULT_ECDH_CURVE }
    常量 __默认_ECDH_曲线__: 文字;
}
